package cn.hzu580.bean;

import javax.annotation.Resource;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import cn.hzu580.dao.BaseDAO;

/**
 * 签到守护线程，处理签到日常
 * @author 沫熊工作室 <a href="http://www.darhao.cc">www.darhao.cc</a>
 */
@Component
public class SignDaemon{
	
	@Resource(name="DAO")
	private BaseDAO baseDAO;
	
	
	/**
	 * 每天0点重置签到状态，并处理连续签到字段
	 */
	@Scheduled(cron="0 0 0 * * ?")
	public void resetSignStateTask(){
		baseDAO.exeUpdate("update User set continuity_sign = 0 where has_sign = false", null);
		baseDAO.exeUpdate("update User set has_sign = false", null);
	}


	public BaseDAO getBaseDAO() {
		return baseDAO;
	}


	public void setBaseDAO(BaseDAO baseDAO) {
		this.baseDAO = baseDAO;
	}

	
	
	
}
